﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using Model;

namespace BLL
{
    public class AuthorityBLL
    {
        AuthorityDAL dal = new AuthorityDAL();

        /// <summary>
        /// 显示权限
        /// </summary>
        /// <returns></returns>
        public List<Authority> ShowAuthority()
        {
            return dal.Show();
        }

        public List<Authority> PaperAuthority(int PageIndex, int PageSize, out int PageCount)
        {
            PageCount = dal.Show().Count();
            return dal.Show().Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList();
        }
        /// <summary>
        /// 添加权限
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public bool AddAuthority(Authority m)
        {
            return dal.Add(m);
        }
        /// <summary>
        /// 删除权限
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public bool DelAuthority(Authority m)
        {
            return dal.Del(m);
        }

        /// <summary>
        /// 查询单个权限信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Authority BackAuthority(int id)
        {
            return dal.Back(id);
        }

        /// <summary>
        /// 修改权限信息
        /// </summary>
        /// <param name="m"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdAuthority(Authority m, int id)
        {
            return dal.Update(m, id);
        }
    }
}
